﻿@************************************************************************************//
// Autor:  			Adrian Di Puglia       						     				*//
//***********************************************************************************//
// SearchIndex()		Acceso solo ADMINISTRADOR	       	    					*//
// Vista que permite visualizar todos los usuarios del sistema, tanto los empleado	*// 
// de MONACA como los externos.                                                     *//
// _________________________________________________________________________________*@

@model PagedList.IPagedList<File_Manager.Models.User_I>

@{
    ViewBag.Title = "Manejo Usuarios";
}

<h2>Manejo Usuarios</h2>
<div class="error">
@ViewBag.msn
</div>
<br />

    @using (Html.BeginForm())
    {   
            <table width="100%">
                    <tr>
                        <td width="50%"> 
                             Turno:<br /> @Html.DropDownList("SearchTurno", "-- Seleccione Opción --")
                        </td>
                        <td width="50%">
                             Sede:<br /> @Html.DropDownList("SearchSede", "-- Seleccione Opción --")
                        </td>
                    </tr>
                    <tr>
                        <td width="50%">
                            Modalidad Pago: <br /> @Html.DropDownList("SearchModoPago", "-- Seleccione Opción --")
                        </td>
                        <td width="50%">
                             Preferencia Academica:<br /> @Html.DropDownList("SearchRol", "-- Seleccione Opción --")
                        </td>
                    </tr>
            </table><br />
         <input type="submit" value="Filtrar" />
    }
</br>
<table width="100%">
    <tr>
        <th>
            Nombre Usuario
        </th>
        <th>
            Nombres
        </th>
        <th>
            Apellidos
        </th>
        <th>
            Preferencia Academica
        </th>
        <th>
            Fecha Registro
        </th>
        <th>
            N° Cuota
        </th>
        <th>
            Status
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.UserName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.last_name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.nRol.name)
        </td>
        <td>
            @*Html.DisplayFor(modelItem => item.transactionDate)*@
            @String.Format("{0:G}", item.registerDate)
        </td>
        <td>
            <font color="red"> @Html.DisplayFor(modelItem => item.n_cuotas_pago)</font> / @Html.DisplayFor(modelItem => item.nModoPago.n_cuotas)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.nStatus.name)
        </td>
        <td>
            @Html.ActionLink("Aprobar/Denegar", "CuotasAdmin", new { id = item.UserName })
        </td>
    </tr>
}

</table>
<br />

<div>
    Pag @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    de @Model.PageCount
    &nbsp;
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<= ", "SearchCuotas", new { page = 1, SearchTurno = ViewBag.CurrentTurno, SearchSede = ViewBag.CurrentSede, SearchModoPago = ViewBag.CurrentModoPago, SearchRol = ViewBag.CurrentRol })
        @Html.Raw("&nbsp;");
        @Html.ActionLink("<=", "SearchCuotas", new { page = Model.PageNumber - 1, SearchTurno = ViewBag.CurrentTurno, SearchSede = ViewBag.CurrentSede, SearchModoPago = ViewBag.CurrentModoPago, SearchRol = ViewBag.CurrentRol })
    }
    else
    {
        @:<<=
        @Html.Raw("&nbsp;");
        @:<=
    }
    &nbsp;
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("=>", "SearchCuotas", new { page = Model.PageNumber + 1, SearchTurno = ViewBag.CurrentTurno, SearchSede = ViewBag.CurrentSede, SearchModoPago = ViewBag.CurrentModoPago, SearchRol = ViewBag.CurrentRol })
        @Html.Raw("&nbsp;");
        @Html.ActionLink(" =>>", "SearchCuotas", new { page = Model.PageCount, SearchTurno = ViewBag.CurrentTurno, SearchSede = ViewBag.CurrentSede, SearchModoPago = ViewBag.CurrentModoPago, SearchRol = ViewBag.CurrentRol })
    }
    else
    {
        @:=>
        @Html.Raw("&nbsp;")
        @:=>>
    }
</div>